<?php

namespace mbilling\BillingBundle\Model;

use Doctrine\ORM\EntityManager;
use mbilling\BillingBundle\Entity\jabberMessages;


Class JabberMessagesModel
{
    protected $em;

    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }
    
    public function findAll()
    {
        $messages = $this->em->getRepository('BillingBundle:jabberMessages')->findAll();
        return $messages;
    }
    
    public function FindByPK($message_id)
    {
        $message = $this->em->find('BillingBundle:jabberMessages', $message_id);
        return $message;
    }
    
    public function create($oEntity)
    {    
        $this->em->persist($oEntity);
        $this->em->flush();
    }
    
    public function removeByPK($message_id)
    {
        $message = $this->em->find('BillingBundle:jabberMessages', $message_id);
        $this->em->remove($message);
        $this->em->flush();
    }
}
?>
